<template>
  <div class="app">
     <!-- navbar组件 -->
     <van-nav-bar
      title="支付订单"
      left-text="返回"
      right-text="..."
      left-arrow
      @click-left="onClickLeft"
    />
    <!-- 收货地址 -->
    <div class="addressbox">
    <div class="list">
        <h5>收货地址：</h5>
      <div class="text">
         <h4> {{addresslist[0].address}}</h4>
      <p><span>{{addresslist[0].name}}</span> <span>{{addresslist[0].phone}}</span></p>
      </div>
     <button @click="$router.push({path:'/edit_address',query:{name:item.name,id:item.id}})"><van-icon name="edit" size="25" /></button>
    </div>
   </div>
   <!-- 订单列表 -->
   <div class="orderList" v-for="(item,index) in payorderlist" :key="index">
        <div class="txt">
            <div class="tit">
                <h4>{{item.name}}</h4>
                <div>{{item.promotion_info}}</div>
            </div>
            <div class="img">
                <img :src="item.picture" alt="">
                <div class="price">
                    <div>￥：{{item.min_price*item.count}}</div>
                    <div>共{{item.count}}件</div>
                </div>
            </div>
        </div>
        <div class="button">
            <button>删除</button>
        </div> 
    </div> 
<!-- 提价订单 -->
    <div class="submit">
       <van-submit-bar :price="3005" button-text="提交订单" @submit="onSubmit" button-color="rgb(63, 175, 219)"/>
    </div>
   
  </div>
</template>

<script>
import { mapState,mapGetters} from 'vuex';
export default {
    computed:{
       ...mapGetters(['totalPrice']),
       ...mapState(['addresslist','payorderlist'])
    },
    methods:{
        onClickLeft(){
            this.$router.go(-1)
        },
        onSubmit(){

        }
    },
}
</script>

<style lang="scss" scoped>
.submit{
    box-sizing: border-box;
}
.list{
  width: 100%;
  height: 120px;
  display: flex;
  padding: 20px;
  background: skyblue;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e8e6e6;
  box-sizing: border-box;
  .text{
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    span{
    color: gray;
    margin-right: 10px;
  }
  }
  button{
    color: rgb(63, 175, 219);
    border: none;
    background: white;
  }
 
}
.orderList{
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  background-color: white;
  border-radius: 5px;
  margin-bottom: 10px;
}
.tit ,
.img{
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}
.tit div{
  color: gray;
  font-size: 14px;
}
.img img{
  width: 60px;
  height: 60px;
}
.price{
  display: flex;
   align-items:flex-end;
  flex-direction: column;
 
}
.price div:last-child{
  color: gray;
  font-size: 14px;
  margin-top: 10px;
}
.orderList button{
  width: 100px;
  height: 40px;
  font-size: 16px;
  font-weight: bolder;
  border-radius: 20px;
  border:1px solid rgb(31, 149, 196);
  color: rgb(31, 149, 196);
  background-color: white;
}
.button{
  display: flex;
  justify-content: right;
}
</style>